package demo;


import java.util.function.IntBinaryOperator;

/**
 * IntBinaryOperator
 *
 * @author dingwen
 * @date 2022/03/23
 */
public class IntBinaryOperatorDemo {
    public static void main(String[] args) {
        IntBinaryOperator addOperator = Integer::sum;
        IntBinaryOperator multiplicationOperator = (x, y) -> x * y;
        test(addOperator,10,10);
        test(multiplicationOperator,10,10);
    }

    /**
     * 测试
     *
     * @param operator 操作符
     * @param x        x
     * @param y        y
     */
    public static void test(IntBinaryOperator operator, int x, int y) {
        int i = operator.applyAsInt(x, y);
        System.out.println("i = " + i);
    }
}
